<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/public/inc/tags.jsp"%>
<html>
<head>
    <jsp:include page="/public/inc/head.jsp"/>
</head>
<body>
<div id="header" class="navbar navbar-static-top" role="navigation">
    <jsp:include page="/public/inc/top.jsp"/>
</div>
<div class="container-fluid" style="margin-top:5px;margin-bottom:60px;">
    <div class="row">
        <jsp:include page="/public/inc/menu.jsp"/>
        <div class="col-xs-12 col-sm-10">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <div class="media">
                        <div class="media-body">
                            <span class="glyphicon glyphicon-list"></span> 首页轮播管理
                        </div>
                    </div>
                </div>
                <div class="panel-body">
                    <div class="form-inline">
                        <form action="/system/wwdx_banner/list">
                            <select name="bannertype" class="form-control">
                                <option value="">类型</option>
                                <option value="6">阅读包</option>
                                <option value="7">会员</option>
                                <option value="8">小课</option>
                                <option value="9">书籍</option>
                                <option value="11">赠一得一</option>
                                <option value="12">书单列表</option>
                                <option value="13">广告</option>
                            </select>
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <button type="submit" class="btn btn-primary">筛选</button>
                        </form>
                    </div>
                </div>
                <div class="table-responsive">
                    <table class="table table-bordered table-hover">
                        <thead>
                        <tr>
                            <th>编码</th>
                            <th>封面</th>
                            <th>类型</th>
                            <th>是否启用</th>
                            <th>标题名称</th>
                            <th>排序</th>
                            <th>添加时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="l" items="${list}" varStatus="status">
                            <tr>
                                <td>
                                        ${status.count}
                                </td>
                                <td>
                                    <img src="http://img.readerday.com/cover/${l.img}"
                                         style="height: 70px;width: 70px;">
                                </td>
                                <td>
                                    <c:choose>
                                        <c:when test="${l.bannertype eq 6 }">
                                            <span class="btn btn-primary btn-xs">阅读包</span>
                                        </c:when>
                                        <c:when test="${l.bannertype eq 7 }">
                                            <span class="btn btn-primary btn-xs">会员</span>
                                        </c:when>
                                        <c:when test="${l.bannertype eq 9 }">
                                            <span class="btn btn-primary btn-xs">单本解读</span>
                                        </c:when>
                                        <c:when test="${l.bannertype eq 11 }">
                                            <span class="btn btn-primary btn-xs">赠一得一</span>
                                        </c:when>
                                        <c:when test="${l.bannertype eq 12 }">
                                            <span class="btn btn-primary btn-xs">书单列表</span>
                                        </c:when>
                                        <c:when test="${l.bannertype eq 13 }">
                                            <span class="btn btn-primary btn-xs">广告</span>
                                        </c:when>
                                        <c:when test="${l.bannertype eq 8 }">
                                            <span class="btn btn-primary btn-xs">小课</span>
                                        </c:when>
                                        <c:otherwise>
                                            <span class="btn btn-danger btn-xs">未知</span>
                                        </c:otherwise>
                                    </c:choose>
                                </td>
                                <td>
                                    <c:choose>
                                        <c:when test="${l.status eq 0 }">
                                            <span class="btn btn-primary btn-xs">是</span>
                                        </c:when>
                                        <c:when test="${l.status eq 1 }">
                                            <span class="btn btn-danger btn-xs">否</span>
                                        </c:when>
                                        <c:otherwise>
                                            <span class="btn btn-danger btn-xs">待定</span>
                                        </c:otherwise>
                                    </c:choose>
                                </td>
                                <td>
                                        ${l.theme}
                                </td>
                                <td>
                                        ${l.sort}
                                </td>
                                <td>
                                        <fmt:formatDate value="${l.gmt_created}" pattern="yyyy-MM-dd HH:mm:ss"/>
                                </td>
                                <td>
                                    <a class="btn btn-primary btn-xs" href="/system/wwdx_banner/edit?bannerid=${l.bannerid}">
                                        <span class="glyphicon glyphicon-pencil"></span> 修改
                                    </a>
                                    <a class="btn btn-danger btn-xs" onclick="del('${l.bannerid}');">
                                        <span class="glyphicon glyphicon-trash"></span> 删除
                                    </a>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
                <div class="panel-footer">
                    <p:pagination url="/system/wwdx_banner/list" total="${listSize}"/>
                </div>
            </div>
        </div>
    </div>
</div>
<jsp:include page="/public/inc/bottom.jsp"/>
</body>
</html>
<script type="text/javascript">
    function del(bannerid) {
        if (window.confirm("确认要删除？")) {
            window.location.href = "/system/wwdx_banner/delete?bannerid=" + bannerid;
        }
    }
</script>